# Maintainer: Martell Malone <martellmalone@gmail.com>

_realname=http-parser
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=2.5.0
pkgrel=1
pkgdesc='Parser for HTTP Request/Response written in C (mingw-w64)'
arch=('any')
url='https://github.com/joyent/http-parser'
license=('MIT')
source=(${_realname}-${pkgver}.tar.gz::"https://github.com/joyent/http-parser/archive/v${pkgver}.tar.gz"
        makefile.patch)
sha256sums=('e3b4ba58f4e6ee5fbec781df020e5cb74c3a799a07f059e1e125127a0b801481'
            '3c20f0ce48b04faaffdd32ca88431e2ff54f597dc7193f3ffc67225d73ea3731')
options=('strip' 'staticlibs')

prepare() {
  cd ${srcdir}/${_realname}-${pkgver}
  patch -p0 -i ${srcdir}/makefile.patch
}

build() {
  cd ${srcdir}/${_realname}-${pkgver}
  CC=gcc \
  AR=ar \
  make -j1 \
    library package
}


package() {
  cd ${srcdir}/${_realname}-${pkgver}
  mkdir -p ${pkgdir}/${MINGW_PREFIX}/{bin,include,lib}
  install -Dm644 http_parser.h "${pkgdir}/${MINGW_PREFIX}/include/http_parser.h"
  cp *.a ${pkgdir}/${MINGW_PREFIX}/lib/
  cp *.dll ${pkgdir}/${MINGW_PREFIX}/bin/
}
